package com.whz.eq;

import lombok.extern.slf4j.Slf4j;

import java.awt.*;
import java.util.Objects;

/**
 * @Author: sinosoft
 * @Description:
 * @Date: Create in 16:54 2021/4/30
 * @Modified By:
 */
@Slf4j
public class ColorPoint extends Point {
    private final Color color;
    public ColorPoint(int x, int y, Color color) {
        super(x, y);
        this.color = color;
    }

    @Override
    public boolean equals(Object o) {
        log.info("ColorPoint.o.getClass() : {}", o.getClass());
        if(!(o instanceof Point)) {
            log.info("ColorPoint.o instanceof Point");
            return false;
        }
        if (!(o instanceof ColorPoint)) {
            log.info("ColorPoint.o instanceof ColorPoint");
            return o.equals(this);
        }
        ColorPoint that = (ColorPoint) o;
        return super.equals(o) && this.color.equals(that.color);
    }
}
